home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
PC World 2007 May
/
PCWorld_2007-05_cd.bin
/
komunikace
/
alleycode
/
alleycodesetup.exe
/
{app}
/
PHP
/
pregmatch.php
< prev
next >
Encoding:
Amiga
Atari
Commodore
DOS
FM Towns/JPY
Macintosh
Macintosh JP
NeXTSTEP
RISC OS/Acorn
UTF-8
Wrap
PHP Script
|
2003-11-08
|
284 b
|
9 lines
<?php
// get host name from URL
preg_match("/^(http:\/\/)?([^\/]+)/i", "http://www.alleycode.com/index.htm", $matches);
$host = $matches[2];
// get last two segments of host name
preg_match("/[^\.\/]+\.[^\.\/]+$/", $host, $matches);
echo "domain name is: {$matches[0]}\n";
?>